<?php
/**
 * Created by PhpStorm.
 * User: xiangfeng
 * Date: 2022/4/8
 * Time: 10:36 PM
 */

namespace app\api\controller;


use app\api\extend\tools\SimpleModelConnectRedis;
use app\api\http\exceptions\ResponseJson;
use app\api\service\UserTokenService;
use think\admin\Controller;
use think\App;

class BaseApi extends Controller
{
    protected $params;
    protected $redis;
    protected $expire;
    protected $login_user;
    use ResponseJson;

    protected function initialize()
    {
        parent::initialize();
        $this->params = $this->request->param();
        $this->redis = SimpleModelConnectRedis::getInstance();
        $this->expire = 60 * 60 * 1;
        $token = $this->request->header('token');
        $this->login_user = UserTokenService::checkToken($token);
    }

    function __construct(App $app)
    {
        parent::__construct($app);
    }
}